reftests: Add reftest for last 2 issues
authorBenjamin Otte <otte@redhat.com>
Sat, 6 Nov 2021 02:38:03 +0000 (03:38 +0100)
committerBenjamin Otte <otte@redhat.com>
Sat, 6 Nov 2021 03:30:50 +0000 (04:30 +0100)
Use a label that is long enough to require wrapping and force it into a
hardcoded width. Use a sentence where all the words have the same size
to not get unwanted wrapping behavior.

Also append a 2nd row to check that the first row gets the proper height
allocated.

Found by Marco Melorio.

testsuite/reftests/listview-with-wrapped-labels.ref.ui [new file with mode: 0644]
testsuite/reftests/listview-with-wrapped-labels.ui [new file with mode: 0644]
testsuite/reftests/meson.build

diff --git a/testsuite/reftests/listview-with-wrapped-labels.ref.ui b/testsuite/reftests/listview-with-wrapped-labels.ref.ui
new file mode 100644 (file)
index 0000000..c64d79f
--- /dev/null
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow" id="window1">
+    <property name="width_request">150</property>
+    <property name="height_request">300</property>
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkScrolledWindow">
+        <child>
+          <object class="GtkListView" id="listview">
+            <property name="factory">
+              <object class="GtkBuilderListItemFactory">
+                <property name="bytes"><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="GtkListItem">
+    <property name="child">
+      <object class="GtkLabel">
+        <property name="xalign">0</property>
+        <property name="wrap">1</property>
+        <binding name="label">
+          <lookup name="string" type="GtkStringObject">
+            <lookup name="item">GtkListItem</lookup>
+          </lookup>
+        </binding>
+      </object>
+    </property>
+  </template>
+</interface>
+                ]]></property>
+              </object>
+            </property>
+            <property name="model">
+              <object class="GtkNoSelection">
+                <property name="model">
+                  <object class="GtkStringList">
+                    <items>
+                      <item>Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.</item>
+                      <item>Hello World!</item>
+                    </items>
+                  </object>
+                </property>
+              </object>
+            </property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/testsuite/reftests/listview-with-wrapped-labels.ui b/testsuite/reftests/listview-with-wrapped-labels.ui
new file mode 100644 (file)
index 0000000..cbbea66
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow" id="window1">
+    <property name="width_request">150</property>
+    <property name="height_request">300</property>
+    <property name="decorated">0</property>
+    <child>
+      <object class="GtkScrolledWindow">
+        <child>
+          <object class="GtkListView" id="listview">
+            <property name="factory">
+              <object class="GtkBuilderListItemFactory">
+                <property name="bytes"><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="GtkListItem">
+    <property name="child">
+      <object class="GtkBox">
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="xalign">0</property>
+                <property name="wrap">1</property>
+                <binding name="label">
+                  <lookup name="string" type="GtkStringObject">
+                    <lookup name="item">GtkListItem</lookup>
+                  </lookup>
+                </binding>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </property>
+  </template>
+</interface>
+                ]]></property>
+              </object>
+            </property>
+            <property name="model">
+              <object class="GtkNoSelection">
+                <property name="model">
+                  <object class="GtkStringList">
+                    <items>
+                      <item>Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.</item>
+                      <item>Hello World!</item>
+                    </items>
+                  </object>
+                </property>
+              </object>
+            </property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
index 692a4274385772aae50e29f4aef50a517b26d8dd..7917c1d3888ec5e8417576d13e0ed697023b5975 100644 (file)
@@ -385,6 +385,8 @@ testdata = [
   'link-coloring.css',
   'link-coloring.ref.ui',
   'link-coloring.ui',
+  'listview-with-wrapped-labels.ref.ui',
+  'listview-with-wrapped-labels.ui',
   'marble.xpm',
   'messagedialog-secondarytext.ui',
   'messagedialog-secondarytext.ref.ui',